VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3195
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3195
ScaleWidth = 4680
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "Time"
Height = 495
Left = 2520
TabIndex = 1
Top = 120
Width = 1455
End
Begin VB.TextBox Text1
Height = 285
Left = 120
TabIndex = 0
Text = "c:\config.sys"
Top = 120
Width = 2175
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Type FILETIME
dwLowDateTime As Long
dwHighDateTime As Long
End Type
Private Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type
Private Declare Function FileTimeToSystemTime Lib "kernel32" (lpFileTime As FILETIME, lpSystemTime As SYSTEMTIME) As Long
Private Declare Function GetFileTime Lib "kernel32" (ByVal hFile As Long, lpCreationTime As FILETIME, lpLastAccessTime As FILETIME, lpLastWriteTime As FILETIME) As Long
Private Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Private Const OF_READ = &H0
Private Type OFSTRUCT
cBytes As Byte
fFixedDisk As Byte
nErrCode As Integer
Reserved1 As Integer
Reserved2 As Integer
szPathName(128) As Byte
End Type
Private Declare Function OpenFile Lib "kernel32" (ByVal lpFileName As String, lpReOpenBuff As OFSTRUCT, ByVal wStyle As Long) As Long
Private Sub Command1_Click()
Dim LastWrite As FILETIME
Dim LastAccess As FILETIME
Dim Creation As FILETIME
Dim LastWriteTime As SYSTEMTIME
Dim LastAccessTime As SYSTEMTIME
Dim CreationTime As SYSTEMTIME
Dim FileHandle As Long
Dim openbuff As OFSTRUCT
FileHandle = OpenFile(Text1.Text, openbuff, OF_READ)
GetFileTime FileHandle, Creation, LastAccess, LastWrite
CloseHandle FileHandle
FileTimeToSystemTime LastWrite, LastWriteTime
FileTimeToSystemTime LastAccess, LastAccessTime
FileTimeToSystemTime Creation, CreationTime
Dim OutPut$
OutPut$ = CreationTime.wDay & "/" & CreationTime.wMonth & "/" & CreationTime.wYear & vbCr & vbLf
OutPut$ = OutPut$ & CreationTime.wHour & ":" & CreationTime.wMinute & ":" & CreationTime.wSecond & vbCr & vbLf
MsgBox OutPut$, , "Creation Details"
OutPut$ = LastAccessTime.wDay & "/" & LastAccessTime.wMonth & "/" & LastAccessTime.wYear & vbCr & vbLf
'Last access dosn't seem to have a time tied to it
'OutPut$ = OutPut$ & LastAccessTime.wHour & ":" & LastAccessTime.wMinute & ":" & LastAccessTime.wSecond & vbCr & vbLf
MsgBox OutPut$, , "Last Access Details"
OutPut$ = LastWriteTime.wDay & "/" & LastWriteTime.wMonth & "/" & LastWriteTime.wYear & vbCr & vbLf
OutPut$ = OutPut$ & LastWriteTime.wHour & ":" & LastWriteTime.wMinute & ":" & LastWriteTime.wSecond & vbCr & vbLf
MsgBox OutPut$, , "Last Write Details"
End Sub